package com.cryptoneedle.garden.api;

import com.bubbles.engine.common.core.result.Result;
import com.cryptoneedle.garden.service.garden.ods.OdsService;
import com.cryptoneedle.garden.vo.JoinTableConfigVo;
import com.cryptoneedle.garden.vo.OdsColumnTranslateVo;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>description:  </p>
 *
 * @author CryptoNeedle
 * @date 2025-11-13
 */
@RestController
@RequestMapping("/garden/ods")
public class OdsController {

    @Resource
    private OdsService odsService;

    @PostMapping("/mapping")
    public Result<?> mappingTableConfig(@Validated @RequestBody JoinTableConfigVo vo) {
        odsService.mappingTableConfig(vo);
        return Result.success();
    }

    @PostMapping("/convert")
    public Result<?> convertTableConfig(@Validated @RequestBody OdsColumnTranslateVo vo) {
        odsService.convertTableConfig(vo);
        return Result.success();
    }

    @PostMapping("/createDwdTable")
    public Result<?> createDwdTable(String tableName) {
        odsService.createDwd(tableName);
        return Result.success();
    }
}